package com.G3.Object;

import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.utils.Array;

public class Player extends Character {
	

	private Player(int type, Vector2 centerPosition) {
		super(type, centerPosition);
		velocity = 30;
	}

	private static final int AMOUNT_PLAYER = 1;
	static int amount = 0;
	
	public static Player getInstrance(Vector2 centerPosition)
	{
		if(amount < AMOUNT_PLAYER)
		{
			return new Player(Player.PLAYER_TYPE, centerPosition);
		}
		return null;
	}

	@Override
	public void moveToAction(float x, float y) {
		if(x - this.getCenterPosition().x > 0)
		{
			if(this.getDrawable().equals(drbLeft))
			{
				this.setDrawable(drbRight);
			}
		}
		else
		{
			if(this.getDrawable().equals(drbRight))
			{
				this.setDrawable(drbLeft);
			}
		}
		this.addAction(Actions.moveTo(x - getWidth()/2, y - getHeight()/2, getDuration(x, y), Interpolation.pow2));
	}
}
